<?php
	function check($x)
	{
		if($x == 1)
		{
			return '<i class="icon-ok"></a>';
		}else{
			return NULL;
		}
	}

?>
<fieldset>
	<legend>Search Date</legend>
	<form action="<?=site_url('employee/archive');?>" method="POST">
		<div class="well">
			<label class="control-label" for="inputEmail">Date</label>
			<input type="text" name="date" class="span2 datepicker" placeholder="date" value="<?=set_value('date');?>" required>
			<input type="submit" name="get_archives" value="Get Attendance" class="btn btn-primary btn-mini">
		</div>
	</form>
</fieldset>
<?if(!empty($schedule)):?>
<fieldset>
	<legend>Daily Time Record (IN/OUT)</legend>
	<?=$system_message;?>

	<table class="table">
	<thead>
		<tr>
			<th>Employee Name</th>
			<th colspan="2" style="text-align:center;">AM</th>
			<th colspan="2" style="text-align:center;">PM</th>
			<th colspan="2" style="text-align:center;">&nbsp;</th>
			<th colspan="2" style="text-align:center;">Overtime</th>
			
		</tr>
		<tr>
			<th>&nbsp;</th>
			<th style="text-align:center;">In</th>
			<th style="text-align:center;">Out</th>
			<th style="text-align:center;">In</th>
			<th style="text-align:center;">Out</th>
			<th>Absent</th>
			<th>On-Leave</th>
			<th>Rest Day</th>
			<th>Holiday</th>
		</tr>
	</thead>
	<tbody>
		<?foreach($schedule as $s):?>
			<tr>
				<td><?=strtoupper($s->lastname).' '.ucwords($s->firstname.' '.$s->middlename[0].'.');?></td>
				<td><?=$s->am_in?></td>
				<td><?=$s->am_out?></td>
				<td><?=$s->pm_in?></td>
				<td><?=$s->pm_out?></td>
				<td style="text-align:center;"><?=check($s->absent);?></td>
				<td style="text-align:center;"><?=check($s->leave);?></td>
				<td style="text-align:center;"><?=check($s->ot_restday);?></td>
				<td style="text-align:center;"><?=check($s->ot_holiday);?></td>
			</tr>
		<?endforeach;?>
	</tbody>
	</table>
	
<?else:?>
	<div class="alert alert-notice">
		No Attendance Found!.
	</div>
<fieldset>
<?endif;?>